((w) => {
  const mutableHandler = {
    get: function (target, key, receiver) {
      const res = Reflect.get(target, key, receiver);
      if (isObject(res)) {
        return createReactive(res);
      }
      return res;
    },
    set: function (target, key, value, receiver) {
      return Reflect.set(target, key, value, receiver);
    },
  };
  function createReactive(data) {
    return createReactiveData(data);
  }
  function createReactiveData(data) {
    if (isObject(data)) {
      return new Proxy(data, mutableHandler);
    }
    return data;
  }
  function isObject(value) {
    return typeof value === "object" && value !== null;
  }

  w.createReactive = createReactive;
})(window);
